# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /cvs/zport/dev-cpp/cil/cil-1.3.7.ebuild,v 1.2 2007/08/22 05:11:55 zechs Exp $

inherit eutils

DESCRIPTION="CIL - a tool which compiles C programs into a simplified subset of C and assists with program analysis and transformation."
HOMEPAGE="http://sourceforge.net/projects/cil"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="x86 ~ppc"

IUSE="llvm"
DEPEND="virtual/libc"

src_compile() {
	cd ${WORKDIR}/${P}
	cflags=
	if use llvm; then
		cflags=--with-llvm
	fi	
	econf ${cflags} || die "econf failed"
	emake -j1 || die "emake failed"
}

src_install() {
	local ocamllib=`ocamlc -where`
	dodir /usr/bin /usr/share/${PN} ${ocamllib}/cil

	cd ${WORKDIR}/${P}
	make DESTDIR=${D} prefix=/usr pkglibdir=${ocamllib}/cil install || die "make install failed"

	insinto ${ocamllib}/cil
	newins ${FILESDIR}/META-${PV} META
}
